<template>
  <div>
    <m-header :title="iNowTitle" :to="to"></m-header>
    <section id="app" class="message_con con">
      <ul class="message_ul message_ul_details">
        <li class="message_li_details" v-html="detailObj.msg_title"></li>
        <li class="message_li_section" v-html="detailObj.msg_desc"></li>
      </ul>
    </section>
  </div>
</template>

<script type="text/ecmascript-6">
  import MHeader from 'base/m-header/m-header'
  import {ERR_OK} from 'config/config'


  export default {
    data() {
      return {
        iNowTitle: '消息详情',
        to:'/messageCenter',
        detailObj: {},
      }
    },
    created() {
      this.getMessageDetail()
    },
    methods: {
      getMessageDetail() {
        if (!this.$route.params || !this.$route.params.msgId) {
          this.$router.push({
            path: 'messageCenter'
          })
          return
        }

        this.$http({
          method: 'post',
          url: '/mobile/api/v1.0/user/updateNotice',
          data: {
            msgId: this.$route.params.msgId
          }
        }).then((res) => {
          if (res.data.code == ERR_OK) {
            this.detailObj = res.data.data.list[0];
          } else {
            this.$router.push({
              path: 'messageCenter'
            })
          }
        }).catch((err) => {
          console.log(err)
        })
      }
    },
    components: {
      MHeader
    }
  }
</script>

<style lang="less" rel="stylesheet/less" scoped>
</style>
